package com.weed.helper;

/**
 * 函数说明:
 *     xml内容对应到对象。
 *
 * 版本    修订人        说明
 * 0.1    Jason Zhuo    新增日志工厂
 */
public class XMLItem {

    /**
     * 接口类
     */
    String interfaceClass;
    /**
     * 实现类
     */
    String implementClass;

    public XMLItem() {
    }

    public XMLItem(String interfaceClass) {
        this.setInterfaceClass(interfaceClass);
    }

    public XMLItem(String name, String interfaceClass, String implementClass) {
        this.setInterfaceClass(interfaceClass);
        this.setImplementClass(implementClass);
    }

    public String getImplementClass() {
        return implementClass;
    }

    public String getInterfaceClass() {
        return interfaceClass;
    }

    public void setImplementClass(String implementClass) {
        this.implementClass = implementClass;
    }

    public void setInterfaceClass(String interfaceClass) {
        this.interfaceClass = interfaceClass;
    }

    public boolean contain(String search) {
        if (search == null) {
            return false;
        }
        if (search.equalsIgnoreCase(implementClass) ||
                search.equalsIgnoreCase(interfaceClass)) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean equals(Object obj) {
        String str = String.valueOf(obj);
        if (str.equalsIgnoreCase(interfaceClass)) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + (this.interfaceClass != null ? this.interfaceClass.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return interfaceClass;
    }

    public String toStringAll() {
        StringBuffer sb = new StringBuffer();
        sb.append("[[interfaceClass=").append(interfaceClass).append("]");
        sb.append("[implementClass=").append(implementClass).append("]]");
        return sb.toString();
    }
}
